#ifndef LOGIN_H
#define LOGIN_H

#include <QWidget>
#include <QPaintEvent>
#include <QPainter>
#include "blldataflow.h"
#include "sqlhelper.h"
#include "passwordmodify.h"

namespace Ui {
class Login;
}

class Login : public QWidget
{
    Q_OBJECT

public:
    explicit Login(QWidget *parent = nullptr);
    ~Login();

public slots:

protected:
    void showEvent(QShowEvent *);

signals:

private slots:
    void on_pbtnLogin_clicked();

    void on_lineUserName_textChanged(const QString &arg1);
    void on_lineUserName_returnPressed();
    void on_linePassword_returnPressed();

    void on_btnShowPw_toggled(bool checked);
    void on_btnForgetPw_clicked();

    void retranslateUiSlot();
    void userLogoutSlot();
    void changePwDoneSlot();

    void onClearPassword();

private:
    void readParam();
    void saveParam();
    void initWidget();
    int setAccountStatus(const User &user, bool loginSuccess);

private:
    Ui::Login *ui;
    BllDataFlow *bdf;
    SqlHelper *sqlHelper;
    bool rememberPwState;
    int wrongPwInputTimes;
    PasswordModify *passwordModify;
};

#endif // LOGIN_H
